#ifndef _74HC595_H
#define _74HC595_H

#include "main.h"
typedef union
{
	uint8 Full;
	struct
	{
		uint8 bit0 : 1;
		uint8 bit1 : 1;
		uint8 bit2 : 1;
		uint8 bit3 : 1;
		uint8 bit4 : 1;
		uint8 bit5 : 1;
		uint8 bit6 : 1;
		uint8 bit7 : 1;
	}buf;
}DATA_595_t;

typedef enum{

	enum_D595_OUT_HEAT_K_AD1_SWITCH =0,
	enum_D595_OUT_HEAT_K_AD2_SWITCH ,
	enum_D595_OUT_QM_POWER ,
	enum_D595_OUT_OVEN_LOOP_FAN_CWCCW_L ,
	enum_D595_OUT_OVEN_LOOP_FAN_L ,
	enum_D595_OUT_OVEN_LOOP_FAN_CWCCW_R ,
	enum_D595_OUT_FR_XH ,
	enum_D595_OUT_FL_XH 
} enum_DATA_595_1;

typedef enum{

	enum_D595_OUT_OVEN_LOOP_FAN_R =0,
	enum_D595_OUT_FR_OUTSIDE_XH ,
	enum_D595_OUT_LAMP_K	,
	enum_D595_OUT_VAL_WATER_L ,
	enum_D595_OUT_LAMP_M ,
	enum_D595_OUT_VAL_WATER_R ,
	enum_D595_OUT_LAMP ,
	enum_D595_OUT_FWD 
} enum_DATA_595_2;


#define D595_OUT_FL_XH					               D595_1.buf.bit7
#define D595_OUT_FR_XH					               D595_1.buf.bit6
#define D595_OUT_OVEN_LOOP_FAN_CWCCW_R         D595_1.buf.bit5
#define D595_OUT_OVEN_LOOP_FAN_L		           D595_1.buf.bit4
#define D595_OUT_OVEN_LOOP_FAN_CWCCW_L	       D595_1.buf.bit3
#define D595_OUT_QM_POWER			                 D595_1.buf.bit2
#define D595_OUT_HEAT_K_AD2_SWITCH		         D595_1.buf.bit1
#define D595_OUT_HEAT_K_AD1_SWITCH		         D595_1.buf.bit0


#define D595_OUT_FWD					                 D595_2.buf.bit7
#define D595_OUT_LAMP					                 D595_2.buf.bit6
#define D595_OUT_VAL_WATER_R		      	       D595_2.buf.bit5
#define D595_OUT_LAMP_M					               D595_2.buf.bit4
#define D595_OUT_VAL_WATER_L			             D595_2.buf.bit3
#define D595_OUT_LAMP_K					               D595_2.buf.bit2
#define D595_OUT_FR_OUTSIDE_XH		             D595_2.buf.bit1
#define D595_OUT_OVEN_LOOP_FAN_R		           D595_2.buf.bit0


extern DATA_595_t D595_1;
extern DATA_595_t D595_2;

void write_595(uint8 dat1,uint8 dat2);

void Set_595_1_bit(uint8 dat1);

void Reset_595_1_bit(uint8 dat1);

void Set_595_2_bit(uint8 dat2);

void Reset_595_2_bit(uint8 dat2);

uint8_t Get_595_1_bit(uint8 dat2);
uint8_t Get_595_2_bit(uint8 dat2);

#endif
